/**
 * @file mapping_options_phrase.cc
 * @author DustinKsi (dustinksi@126.com)
 * @brief
 * @version 0.1
 * @date 2019-12-12
 *
 * @copyright Copyright (c) 2019
 *
 */

#include "venus/mapping/mapping_options_phrase.h"

namespace VEnus {
namespace Mapping {

MappingOptions CreateOptions(ParamDict* const mapping_params) {
  MappingOptions options;
  options.set_load_map(mapping_params->GetBool("load_map"));
  options.set_map_filename(mapping_params->GetString("map_filename"));
  options.set_use_full_graph(mapping_params->GetBool("use_full_graph"));
  options.set_use_graph_mst(mapping_params->GetBool("use_graph_mst"));
  options.set_distance_match_tolerance(mapping_params->GetDouble("distance_match_tolerance"));
  options.set_relocate_match_tolerance(mapping_params->GetDouble("relocate_match_tolerance"));
  options.set_distance_ceil_threshold(mapping_params->GetDouble("distance_ceil_threshold"));
  options.set_merge_distance(mapping_params->GetDouble("merge_distance"));
  options.set_id_diff_ceil_threshold(mapping_params->GetInt("id_diff_ceil_threshold"));
  options.set_init_edge_belief(mapping_params->GetDouble("init_edge_belief"));

  CHECK_NE(options.map_filename().size(), 0) << "map_filename should not empty, check your param lua file.";

  D_INFO << "================VEnus::Mapping================";
  PARAM_LOG(load_map) << options.load_map();
  PARAM_LOG(map_filename) << options.map_filename();
  PARAM_LOG(use_full_graph) << (options.use_full_graph() ? "true" : "false");
  PARAM_LOG(use_graph_mst) << (options.use_graph_mst() ? "true" : "false");
  PARAM_LOG(distance_match_tolerance) << options.distance_match_tolerance();
  PARAM_LOG(relocate_match_tolerance) << options.relocate_match_tolerance();
  PARAM_LOG(distance_ceil_threshold) << options.distance_ceil_threshold();
  PARAM_LOG(merge_distance) << options.merge_distance();
  PARAM_LOG(id_diff_ceil_threshold) << options.id_diff_ceil_threshold();
  PARAM_LOG(init_edge_belief) << options.init_edge_belief();

  return options;
}
}
}
